package com.szbmyoubao.app.ui.main.home

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import com.ellecity06.common.base.BaseMvvmFragment
import com.ellecity06.cwhiskymall.databinding.FragmentHomeBinding


/**
 * @author ellecity06
 * @time 2024/10/22 14:49
 * @des 首页
 */
class HomeFragment : BaseMvvmFragment<FragmentHomeBinding, HomeViewModel>(), View.OnClickListener {
    override fun lazyInit() {

    }



    override fun inflateBinding(
        inflater: LayoutInflater, container: ViewGroup?
    ): FragmentHomeBinding {
        return FragmentHomeBinding.inflate(inflater, container, false)
    }


    override fun onClick(p0: View?) {

    }

    private fun dandleScanResult(code: String) {
        //  https://www.pgyer.com/8Hu49ReN
        if (code.startsWith("https://www.pgyer.com/")) {
            // 扫描了下载码
            lifecycleScope.launchWhenCreated {
                val code = code.substringAfter("https://www.pgyer.com/")
                viewModel.sendUiIntent(HomeIntent.FetchDebugAppInfo(code))
            }

        }
    }

    companion object {
        @JvmStatic
        fun newInstance(): HomeFragment {
            return HomeFragment()
        }

    }


}